using System.Collections.Generic;

namespace ICSharpCode.TextEditor.Document
{
    public class SegmentComparer : IComparer<ISegment>
    {
        public int Compare(ISegment x, ISegment y)
        {
            if (x == null)
            {
                if (y == null)
                {
                    return 0;
                }
                return -1;
            }
            if (y == null)
            {
                return 1;
            }
            int num = x.Offset.CompareTo(y.Offset);
            if (num != 0)
            {
                return num;
            }
            return x.Length.CompareTo(y.Length);
        }
    }
}
